package com.taomu.app.zongchouhuli.moudle.home.activity;

import android.content.Intent;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.taomu.app.zongchouhuli.R;
import com.taomu.app.zongchouhuli.framework.BaseActivity;
import com.taomu.app.zongchouhuli.framework.BasePresenter;
import com.taomu.app.zongchouhuli.utils.dialog.PayPasswordDialog;

/**
 * 立即支付
 */
public class HomePayDetailActivity extends BaseActivity {

    private ImageView mBackIm;

    private TextView mPriceTv;

    private TextView mOrderNumTv;

    private TextView mSubmitTv;

    @Override
    protected int getContentLayout() {
        return R.layout.activity_home_pay_detail;
    }

    @Override
    protected void initView() {
        mBackIm = findViewById(R.id.pay_detail_back_im);
        mPriceTv = findViewById(R.id.pay_detail_price_tv);
        mOrderNumTv = findViewById(R.id.pay_detail_order_num);
        mSubmitTv = findViewById(R.id.pay_detail_submit_tv);
    }

    @Override
    protected void initData() {

    }

    @Override
    protected void initEvent() {
        mBackIm.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        mSubmitTv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                showInputPwd();
            }
        });
    }

    @Override
    protected BasePresenter createPresenter() {
        return null;
    }

    private void showInputPwd(){
        PayPasswordDialog dialog = PayPasswordDialog.getInstence(this,"余额支付",666);
        dialog.setPayPasswordListener(new PayPasswordDialog.PayPasswordListener() {
            @Override
            public void onFinishInput(String pwd) {
                //验证密码，正确进入成功
                //失败，停留该界面
                //todo:测试，默认成功
                Intent intent = new Intent(HomePayDetailActivity.this,HomePaySuccessActivity.class);
                startActivity(intent);
                finish();
            }
        });
        dialog.show();
    }
}
